atspi: Use name and description as provided
authorMatthias Clasen <mclasen@redhat.com>
Mon, 19 Oct 2020 18:57:43 +0000 (14:57 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 19 Oct 2020 18:57:43 +0000 (14:57 -0400)
GtkATContext already does fallbacks to derive values
for these, so no need for the atspi implementation to
do its own fallback on top of that.

gtk/a11y/gtkatspicontext.c

index 1a2434ff7ceb3434192317005b1fda80fdfedfff..6c3810a1fd9d0ab157f7dcde5ed1254159ebca51 100644 (file)
@@ -592,29 +592,14 @@ handle_accessible_get_property (GDBusConnection       *connection,
 
   if (g_strcmp0 (property_name, "Name") == 0)
     {
-      if (GTK_IS_WIDGET (accessible))
-        res = g_variant_new_string (gtk_widget_get_name (GTK_WIDGET (accessible)));
-      else if (GTK_IS_STACK_PAGE (accessible))
-        {
-          const char *name = gtk_stack_page_get_name (GTK_STACK_PAGE (accessible));
-          if (name == NULL)
-             name = G_OBJECT_TYPE_NAME (accessible);
-          res = g_variant_new_string (name);
-        }
-      else
-        res = g_variant_new_string (G_OBJECT_TYPE_NAME (accessible));
+      char *label = gtk_at_context_get_name (GTK_AT_CONTEXT (self));
+      res = g_variant_new_string (label ? label : "");
+      g_free (label);
     }
   else if (g_strcmp0 (property_name, "Description") == 0)
     {
       char *label = gtk_at_context_get_description (GTK_AT_CONTEXT (self));
-
-      if (label == NULL || *label == '\0')
-        {
-          g_free (label);
-          label = gtk_at_context_get_name (GTK_AT_CONTEXT (self));
-        }
-
-      res = g_variant_new_string (label);
+      res = g_variant_new_string (label ? label : "");
       g_free (label);
     }
   else if (g_strcmp0 (property_name, "Locale") == 0)